home *** CD-ROM | disk | FTP | other *** search
Wrap
Path: uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!vsi1!ubvax!weitek!amdcad.amd.com!sun!kimba From: hvr@kimba (Heather Rose) Newsgroups: comp.sources.x Subject: v07i013: Spider, Patch1, Part01/01 Message-ID: <135056@sun.Eng.Sun.COM> Date: 1 May 90 06:36:18 GMT Sender: news@sun.Eng.Sun.COM Lines: 1312 Approved: argv@sun.com Submitted-by: hvr@kimba (Heather Rose) Posting-number: Volume 7, Issue 13 Archive-name: spider/patch1 #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # patchlevel.h # changed.out # patch.out # This archive created: Mon Apr 30 20:18:19 1990 export PATH; PATH=/bin:/usr/bin:$PATH echo "#define PATCHLEVEL 1" > patchlevel.h if test -f 'changed.out' then echo shar: "will not over-write existing file 'changed.out'" else cat << \SHAR_EOF > 'changed.out' ./Imakefile ./doc.rules ./util.c ./version.c ./xaw_ui.h ./defs.h ./events.c ./xaw_stubs.c ./README ./xaw_ui.c ./xv_ui.c ./xv_stubs.c ./gfx.c ./spider.info SHAR_EOF fi if test -f 'patch.out' then echo shar: "will not over-write existing file 'patch.out'" else cat << \SHAR_EOF > 'patch.out' *** /tmp/spider/./Imakefile Mon Apr 30 19:55:41 1990 --- ./Imakefile Mon Apr 30 20:00:25 1990 *************** *** 2,19 **** /**/# This is an R4 style Imakefile, so will need the R4 config files to /**/# to make a Makefile. It also assume that X11 is installed in /usr/lib. ! SHAR = shar -a ! RM = rm -f ! COMPRESS = compress ! BTOA = btoa ! SPLIT = split ! CC = cc ! CAT = cat ! HELPDIR = . ! /***** Note: only need XViewNeedsOlgx when using XView 2.0 or greater *****/ #ifndef XViewNeedsOlgx ! #define XViewNeedsOlgx YES #endif /***** Note: cannot have CompileXlibOnly, CompileXView, and CompileXAW --- 2,54 ---- /**/# This is an R4 style Imakefile, so will need the R4 config files to /**/# to make a Makefile. It also assume that X11 is installed in /usr/lib. ! SHAR = shar -a ! COMPRESS = compress ! BTOA = btoa ! SPLIT = split ! CAT = cat ! /***** Note: probably want to define this to be something else *****/ ! HELPDIR = help ! /***** Note: Used to over-ride some declarations in the default Imakefile ! configurations. If you want to use some of these things, then ! set OverrideDefs to YES below and change the corresponding ! definitions to what you would like them to be below. Delete ! or comment out those you do not wish to use *****/ ! #ifndef OverrideDefs ! #define OverrideDefs NO ! #endif ! ! #if OverrideDefs ! ! # ifdef ManSuffix ! # undef ManSuffix ! # define ManSuffix 1 ! # else ! # define ManSuffix 1 ! # endif ! MANSUFFIX = ManSuffix ! MANDIR = ./man$(MANSUFFIX) ! BINDIR = ./bin ! MKDIRHIER = /usr/bin/X11/mkdirhier ! ! #endif /* OverrideDefs */ ! ! /***** Note: if your OS or libc does not have usleep defined, set this ! to YES. (SunOS is one that does have usleep in libc) *****/ ! #ifndef NeedsLocalUsleep ! #define NeedsLocalUsleep NO ! #endif ! ! /***** Note: if your OS or libc does not have strdup defined, set this ! to YES. (SunOS is one that does have strdup in libc) *****/ ! #ifndef NeedsLocalStrdup ! #define NeedsLocalStrdup NO ! #endif ! ! /***** Note: only need XViewHasOlgx when using XView 2.0 or greater *****/ #ifndef XViewNeedsOlgx ! #define XViewNeedsOlgx NO #endif /***** Note: cannot have CompileXlibOnly, CompileXView, and CompileXAW *************** *** 58,98 **** # endif #endif /**/# If these are not defined in the site.def file, define them now. /**/# set up compile time dependencies for XView clients. ! XVTOP = $(XVIEWHOME) ! XVLIBSRC = $(XVTOP)/lib ! #if UseInstalled ! DEPXVIEWLIB = ! DEPOLGXLIB = ! #else ! DEPXVIEWLIB = $(XVLIBSRC)/libxview.a # if XViewNeedsOlgx ! DEPOLGXLIB = $(XVLIBSRC)/libolgx.a # else ! DEPOLGXLIB = # endif ! #endif ! XVIEWLIB = -L$(XVLIBSRC) -lxview ! #if XViewNeedsOlgx ! OLGXLIB = -L$(XVLIBSRC) -lolgx ! #else ! OLGXLIB = ! #endif ! KL_DIST = main.c #if CompileXlibOnly # if RoundCards ! DEPLIBS = $(DEPXMULIB) $(DEPXLIB) ! LOCAL_LIBRARIES = $(XMULIB) $(XLIB) # else ! DEPLIBS = $(DEPXLIB) LOCAL_LIBRARIES = $(XLIB) # endif - SYSTEM_LIBRARIES = - DEPEXTENSIONLIB = - EXTENSIONLIB = - TKOBJS = main.o TKSRCS = main.c --- 93,131 ---- # endif #endif + #if CompileXView /**/# If these are not defined in the site.def file, define them now. /**/# set up compile time dependencies for XView clients. ! XVTOP = $(XVIEWHOME) ! XVLIBSRC = $(XVTOP)/lib ! # if UseInstalled ! DEPXVIEWLIB = ! DEPOLGXLIB = ! # else ! DEPXVIEWLIB = $(XVLIBSRC)/libxview.a ! # if XViewNeedsOlgx ! DEPOLGXLIB = $(XVLIBSRC)/libolgx.a ! # else ! DEPOLGXLIB = ! # endif ! # endif ! XVIEWLIB = -L$(XVLIBSRC) -lxview # if XViewNeedsOlgx ! OLGXLIB = -L$(XVLIBSRC) -lolgx # else ! OLGXLIB = # endif ! #endif /* CompileXView */ ! KL_DIST = main.c #if CompileXlibOnly # if RoundCards ! DEPLIBS = $(DEPXMULIB) $(DEPXLIB) ! LOCAL_LIBRARIES = $(XMULIB) $(XLIB) # else ! DEPLIBS = $(DEPXLIB) LOCAL_LIBRARIES = $(XLIB) # endif TKOBJS = main.o TKSRCS = main.c *************** *** 107,172 **** TKINCLUDES = ! TARGET = spider ! #endif ! XVIEW_DIST = xv_ui.c xv_stubs.c xv_ui.h spider.info #if CompileXView # if RoundCards ! DEPLIBS = $(DEPXVIEWLIB) $(DEPOLGXLIB) $(DEPXMULIB) $(DEPXLIB) ! LOCAL_LIBRARIES = $(XVIEWLIB) $(OLGXLIB) $(XMULIB) $(XLIB) # else ! DEPLIBS = $(DEPXVIEWLIB) $(DEPOLGXLIB) $(DEPXLIB) ! LOCAL_LIBRARIES = $(XVIEWLIB) $(OLGXLIB) $(XLIB) # endif ! SYSTEM_LIBRARIES = ! DEPEXTENSIONLIB = ! EXTENSIONLIB = ! TKOBJS = xv_ui.o xv_stubs.o ! TKSRCS = xv_ui.c xv_stubs.c ! TKHEADERS = xv_ui.h ! TKBITMAPS = ! TKDOCS = spider.info ! TKDEFINES = -DXVIEW ! TKINCLUDES = -I$(XVTOP)/include ! TARGET = spider ! #endif ! ! XAW_DIST = xaw_ui.c xaw_stubs.c xaw_ui.h #if CompileXAW DEPLIBS = $(DEPXAWLIB) $(DEPXTOOLLIB) $(DEPXMULIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XLIB) - SYSTEM_LIBRARIES = - DEPEXTENSIONLIB = - EXTENSIONLIB = ! TKOBJS = xaw_ui.o xaw_stubs.o ! TKSRCS = xaw_ui.c xaw_stubs.c ! TKHEADERS = xaw_ui.h ! TKBITMAPS = ! TKDOCS = ! TKDEFINES = -DXAW ! TKINCLUDES = ! TARGET = spider ! #endif BASE_OBJS = gfx.o spider.o events.o windows.o movelog.o util.o version.o ! OBJS = $(BASE_OBJS) $(TKOBJS) BASE_SRCS = gfx.c spider.c events.c windows.c movelog.c util.c version.c SRCS = $(BASE_SRCS) $(TKSRCS) --- 140,198 ---- TKINCLUDES = ! TARGET = spider ! #endif /* CompileXlibOnly */ ! XVIEW_DIST = xv_ui.c xv_stubs.c xv_ui.h spider.info #if CompileXView # if RoundCards ! DEPLIBS = $(DEPXVIEWLIB) $(DEPOLGXLIB) $(DEPXMULIB) $(DEPXLIB) ! LOCAL_LIBRARIES = $(XVIEWLIB) $(OLGXLIB) $(XMULIB) $(XLIB) # else ! DEPLIBS = $(DEPXVIEWLIB) $(DEPOLGXLIB) $(DEPXLIB) ! LOCAL_LIBRARIES = $(XVIEWLIB) $(OLGXLIB) $(XLIB) # endif ! TKOBJS = xv_ui.o xv_stubs.o ! TKSRCS = xv_ui.c xv_stubs.c ! TKHEADERS = xv_ui.h ! TKBITMAPS = ! TKDOCS = spider.info ! TKDEFINES = -DXVIEW ! TKINCLUDES = -I$(XVTOP)/include ! TARGET = spider ! #endif /* CompileXView */ ! XAW_DIST = xaw_ui.c xaw_stubs.c xaw_ui.h #if CompileXAW DEPLIBS = $(DEPXAWLIB) $(DEPXTOOLLIB) $(DEPXMULIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XLIB) ! TKOBJS = xaw_ui.o xaw_stubs.o ! TKSRCS = xaw_ui.c xaw_stubs.c ! TKHEADERS = xaw_ui.h ! TKBITMAPS = ! TKDOCS = ! TKDEFINES = -DXAW ! TKINCLUDES = ! TARGET = spider ! #endif /* CompileXAW */ BASE_OBJS = gfx.o spider.o events.o windows.o movelog.o util.o version.o ! OBJS = $(BASE_OBJS) $(TKOBJS) BASE_SRCS = gfx.c spider.c events.c windows.c movelog.c util.c version.c SRCS = $(BASE_SRCS) $(TKSRCS) *************** *** 177,197 **** BASE_BITMAPS = rank.bm suit.bm face.bm spider.bm cards.bm.aa cards.bm.ab BITMAPS = $(BASE_BITMAPS) $(TKBITMAPS) ! BASE_DOCS = doc.intro doc.rules doc.controls doc.examples doc.summary spider.man ! DOCS = $(BASE_DOCS) $(TKDOCS) ! MISC = Imakefile Makefile.sunpro README ALL_SRCS = $(MISC) $(BASE_SRCS) $(BASE_HEADERS) $(BASE_BITMAPS) $(BASE_DOCS) \ ! $(XVIEW_DIST) $(XAW_DIST) $(KL_DIST) #if SmallCards ! DEFINES = $(TKDEFINES) -DSMALL_CARDS -DHELPDIR="\"$(HELPDIR)\"" #else # if RoundCards ! DEFINES = $(TKDEFINES) -DROUND_CARDS -DHELPDIR="\"$(HELPDIR)\"" # else ! DEFINES = $(TKDEFINES) -DHELPDIR="\"$(HELPDIR)\"" # endif #endif --- 203,237 ---- BASE_BITMAPS = rank.bm suit.bm face.bm spider.bm cards.bm.aa cards.bm.ab BITMAPS = $(BASE_BITMAPS) $(TKBITMAPS) ! BASE_DOCS = doc.intro doc.rules doc.controls doc.examples doc.misc doc.summary ! DOCS = $(BASE_DOCS) $(TKDOCS) ! MISC = Imakefile Makefile.sunpro README spider.man ALL_SRCS = $(MISC) $(BASE_SRCS) $(BASE_HEADERS) $(BASE_BITMAPS) $(BASE_DOCS) \ ! $(XVIEW_DIST) $(XAW_DIST) $(KL_DIST) + #if NeedsLocalUsleep + # if NeedsLocalStrdup + UTILDEFS = -DLOCAL_USLEEP -DLOCAL_STRDUP + # else + UTILDEFS = -DLOCAL_USLEEP + # endif + #else + # if NeedsLocalStrdup + UTILDEFS = -DLOCAL_STRDUP + # else + UTILDEFS = + # endif + #endif + #if SmallCards ! DEFINES = $(TKDEFINES) -DSMALL_CARDS -DHELPDIR="\"$(HELPDIR)\"" $(UTILDEFS) #else # if RoundCards ! DEFINES = $(TKDEFINES) -DROUND_CARDS -DHELPDIR="\"$(HELPDIR)\"" $(UTILDEFS) # else ! DEFINES = $(TKDEFINES) -DHELPDIR="\"$(HELPDIR)\"" $(UTILDEFS) # endif #endif *************** *** 199,208 **** --- 239,254 ---- CPPFLAGS = + all:: $(TARGET) + #if SmallCards all:: -@if [ ! -f cards.bm ]; then cat cards.bm.aa cards.bm.ab > cards.bm; fi #endif + #if OverrideDefs + MakeDirectories(install,$(BINDIR)) + MakeDirectories(install.man, $(MANDIR)) + #endif ComplexProgramTarget($(TARGET)) *************** *** 209,225 **** #ifdef SparcArchitecture /**/# SunOS4.0.3 sparc optimizer slimes this file util.o: util.c ! $(CC) $(CPPFLAGS) $(DEFINES) $(INCLUDES) -c $< #endif ! version.o:: version.c ! $(CC) -c -DDATE="\"`date`\"" $< ! MakeDirectories(install,$(HELPDIR)) ! InstallMultipleDest(install,$(DOCS),$(HELPDIR)) clean:: ! $(RM) spider.shar spider.a spider.a.a? shar:: $(SHAR) $(ALL_SRCS) > spider.shar --- 255,312 ---- #ifdef SparcArchitecture /**/# SunOS4.0.3 sparc optimizer slimes this file util.o: util.c ! $(CC) $(CPPFLAGS) $(DEFINES) $(INCLUDES) -c util.c #endif ! version.o: version.c ! $(CC) -DDATE="\"`date`\"" -c version.c ! MakeDirectories(install.doc,$(HELPDIR)) ! InstallMultipleDest(install.doc,$(DOCS),$(HELPDIR)) + World:: + @echo "" + @echo "Begin build of the $(TARGET) application for the" + #if CompileXView + @echo "XView toolkit version." + #else + # if CompileXlibOnly + @echo "Xlib only, no toolkit version." + # else + # if CompileXAW + @echo "Athena Widget toolkit version." + # endif + # endif + #endif + #if SmallCards + @echo "Using cards with small bitmaps for a low resolution display." + #else + # if RoundCards + @echo "Using cards with normal bitmaps and optional rounded edges." + # else + @echo "Using cards with normal bitmaps." + # endif + #endif + @echo "" + @date + @echo "" + $(MAKE) $(MFLAGS) clean + $(MAKE) $(MFLAGS) depend + $(MAKE) $(MFLAGS) + @echo "" + @date + @echo "" + @echo "Begin installation... " + $(MAKE) $(MFLAGS) -k install + $(MAKE) $(MFLAGS) -k install.doc + $(MAKE) $(MFLAGS) -k install.man + @echo "" + @date + @echo "" + @echo "Installation complete...now type 'make clean'" + clean:: ! $(RM) spider.shar spider.a spider.a.a?a cards.bm shar:: $(SHAR) $(ALL_SRCS) > spider.shar *** /tmp/spider/./doc.rules Mon Apr 30 19:55:45 1990 --- ./doc.rules Mon Apr 30 11:18:13 1990 *************** *** 1,5 **** --- 1,37 ---- II. R U L E S F O R S P I D E R + The object of the game is to build a stack of cards in the same suit from + King to Ace and remove the stack from the table to the stacks above. When + all eight stacks have been built and removed, you have won the game. A + more challenging version of this is to leave all eight stacks on the table + until done instead of removing those that are complete to the stacks above. + + One may move the next lower card onto a card of the same or different suit; + however, one may only move contiguous cards of the same suit as a group. For + example, one may move the 5 of spades into either a 6 of spades or a 6 of + hearts. Moving the 5 of spades onto the 6 spades is a better move since now + the 5-6 of spades group may be moved as a unit where the 5 of spades, 6 of + hearts group may not. Also, moving the 4 of spades onto the 6 of spades is + not a legal move. A King may only be moved into a space (or removed to the + stacks above when the sequence K-Ace is complete) since there are no + higher cards than a King. + + For general strategy, one wants to try to create a "space" since this is + the most flexible way to move cards around. A space is where all cards in + the table have been removed. Note: before dealing the next round, all + spaces have to have at least one card in them. + + Also, when moving the cards, it is generally to your advantage to move + the highest cards first and the lowest cards last doing the obvious moves + first. For example, move a 5 of spades onto a 6 of spades, then Queen of + hearts onto a King clubs before you move the 7 of clubs onto the 8 of hearts. + Then you may choose to move 5-6 of spades group onto the 7 of clubs. The + strategy is to combine the cards into same suit groups that may be moved as + a unit. Once the group 5-6 of spades has been created, it may be broken + up by using the middle mouse button on the lower card. + + More details about the game are below... + THE INITIAL TABLEAU. Shuffle together two decks of cards (104 cards in all) and deal ten cards face down in a row. Deal three more rows face down on the first. Next deal one card face down on each of four piles (traditionally the *** /tmp/spider/./util.c Mon Apr 30 19:55:49 1990 --- ./util.c Mon Apr 30 19:01:04 1990 *************** *** 6,25 **** * * See copyright.h for the terms of the copyright. * ! * @(#)util.c 2.1 90/04/27 * */ /* - * Sun libc has strdup() and usleep(), but other OS's need - * them - */ - #ifndef sun - #define LOCAL_USLEEP - #define LOCAL_STRDUP - #endif - - /* * misc utility funcs */ --- 6,16 ---- * * See copyright.h for the terms of the copyright. * ! * @(#)util.c 2.3 90/04/30 * */ /* * misc utility funcs */ *************** *** 52,58 **** static Atom target = (Atom) 0; Window win; unsigned char *prop; ! XSelectionEvent ev; Atom type; int format; unsigned long elmts, left; --- 43,50 ---- static Atom target = (Atom) 0; Window win; unsigned char *prop; ! XEvent ev; ! XSelectionEvent *sev; Atom type; int format; unsigned long elmts, left; *************** *** 101,107 **** XSync(dpy, 0); /* wait for notification */ ! while(XCheckTypedEvent(dpy, SelectionNotify, &ev) == False) { XSync(dpy, 0); if (retry++ == NUM_RETRIES) return (NULL); --- 93,99 ---- XSync(dpy, 0); /* wait for notification */ ! while(XCheckTypedEvent(dpy, SelectionNotify, &ev) == False) { XSync(dpy, 0); if (retry++ == NUM_RETRIES) return (NULL); *************** *** 108,117 **** sleep(1); } ! if (ev.property == None) /* nothing to get */ return (NULL); ! (void)XGetWindowProperty(dpy, table, ev.property, 0L, 1024L, False, AnyPropertyType, &type, &format, &elmts, &left, &prop); --- 100,112 ---- sleep(1); } ! sev = (XSelectionEvent *)&ev; ! ! if (sev->property == None) /* nothing to get */ return (NULL); ! (void)XGetWindowProperty(dpy, table, sev->property, ! 0L, 1024L, False, AnyPropertyType, &type, &format, &elmts, &left, &prop); *************** *** 217,223 **** #ifdef LOCAL_USLEEP #include <signal.h> ! #include <time.h> usleep(value) long value; --- 212,218 ---- #ifdef LOCAL_USLEEP #include <signal.h> ! #include <X11/Xos.h> /* for (sys/)time.h */ usleep(value) long value; *** /tmp/spider/./version.c Mon Apr 30 19:55:51 1990 --- ./version.c Mon Apr 30 19:27:04 1990 *************** *** 12,15 **** char *version = "1.00"; char *build_date = DATE; ! --- 12,15 ---- char *version = "1.00"; char *build_date = DATE; ! char *patch_level = "1"; *** /tmp/spider/./xaw_ui.h Mon Apr 30 19:55:52 1990 --- ./xaw_ui.h Mon Apr 30 19:01:37 1990 *************** *** 6,12 **** * * See copyright.h for the terms of the copyright. * ! * @(#)xaw_ui.h 2.1 90/04/25 * */ --- 6,12 ---- * * See copyright.h for the terms of the copyright. * ! * @(#)xaw_ui.h 2.2 90/04/30 * */ *************** *** 29,35 **** #include <X11/Xaw/Cardinals.h> ! extern XtCallbackProc score_handler(), backup_handler(), expand_handler(), locate_handler(), --- 29,35 ---- #include <X11/Xaw/Cardinals.h> ! extern void score_handler(), backup_handler(), expand_handler(), locate_handler(), *************** *** 39,45 **** newgame_handler(), confirm_callback(); ! extern XtEventHandler xaw_redraw_table(), xaw_button_press(), xaw_button_release(), xaw_resize(), --- 39,45 ---- newgame_handler(), confirm_callback(); ! extern void xaw_redraw_table(), xaw_button_press(), xaw_button_release(), xaw_resize(), *** /tmp/spider/./defs.h Mon Apr 30 19:55:54 1990 --- ./defs.h Mon Apr 30 18:58:04 1990 *************** *** 6,12 **** * * See copyright.h for the terms of the copyright. * ! * @(#)defs.h 2.1 90/04/25 * */ --- 6,12 ---- * * See copyright.h for the terms of the copyright. * ! * @(#)defs.h 2.2 90/04/30 * */ *************** *** 15,20 **** --- 15,21 ---- */ #include <X11/Xlib.h> #include <X11/Xutil.h> + #include <X11/Xos.h> #include <stdio.h> #include "assert.h" #include "copyright.h" *** /tmp/spider/./events.c Mon Apr 30 19:55:55 1990 --- ./events.c Mon Apr 30 19:00:35 1990 *************** *** 6,12 **** * * See copyright.h for the terms of the copyright. * ! * @(#)events.c 2.1 90/04/25 * */ --- 6,12 ---- * * See copyright.h for the terms of the copyright. * ! * @(#)events.c 2.3 90/04/30 * */ *************** *** 218,223 **** --- 218,229 ---- current_card = coords_to_card(xev->x, xev->y); if (current_card == CARDNULL) return; + /* ignore facedown cards */ + if (current_card->type != Faceup) { + current_card = CARDNULL; + current_list = coords_to_list(xev->x, xev->y); + return; + } #ifdef DEBUG if (xev->state & ShiftMask) { current_list = coords_to_list(xev->x, xev->y); *************** *** 358,366 **** char buf[512]; char *fname; int num; ! #ifdef XVIEW ! extern char *get_selection(); ! #endif /* XVIEW */ num = XLookupString(xev, str, 32, NULL, NULL); if (num == 0) --- 364,374 ---- char buf[512]; char *fname; int num; ! #ifdef KITLESS ! #define get_name_field(x) get_selection(x) ! #else ! extern char *get_name_field(); ! #endif /* KITLESS */ num = XLookupString(xev, str, 32, NULL, NULL); if (num == 0) *************** *** 368,374 **** switch (str[0]) { case 'f': /* find card */ case 'F': ! if ((fname = get_selection()) == NULL) { show_message("Selection is unusable or unobtainable."); } else { locate(fname); --- 376,382 ---- switch (str[0]) { case 'f': /* find card */ case 'F': ! if ((fname = get_name_field()) == NULL) { show_message("Selection is unusable or unobtainable."); } else { locate(fname); *************** *** 376,382 **** break; case 'l': case 'L': ! if ((fname = get_selection()) == NULL) { show_message("Selection is unusable or unobtainable."); } else { read_file_or_selection(fname); --- 384,390 ---- break; case 'l': case 'L': ! if ((fname = get_name_field()) == NULL) { show_message("Selection is unusable or unobtainable."); } else { read_file_or_selection(fname); *************** *** 387,393 **** case 'w': case 'W': /* write to selection */ ! if ((fname = get_selection()) == NULL) { show_message("Selection is unusable or unobtainable."); } else { write_file(fname, write_confirmer); --- 395,401 ---- case 'w': case 'W': /* write to selection */ ! if ((fname = get_name_field()) == NULL) { show_message("Selection is unusable or unobtainable."); } else { write_file(fname, write_confirmer); *** /tmp/spider/./xaw_stubs.c Mon Apr 30 19:55:56 1990 --- ./xaw_stubs.c Mon Apr 30 19:01:36 1990 *************** *** 6,12 **** * * See copyright.h for the terms of the copyright. * ! * @(#)xaw_stubs.c 2.2 90/04/27 * */ --- 6,12 ---- * * See copyright.h for the terms of the copyright. * ! * @(#)xaw_stubs.c 2.4 90/04/30 * */ *************** *** 26,32 **** Bool confirm; /* ARGSUSED */ ! XtCallbackProc score_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; --- 26,32 ---- Bool confirm; /* ARGSUSED */ ! void score_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; *************** *** 39,45 **** } /* ARGSUSED */ ! XtCallbackProc newgame_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; --- 39,45 ---- } /* ARGSUSED */ ! void newgame_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; *************** *** 51,57 **** } /* ARGSUSED */ ! XtCallbackProc backup_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; --- 51,57 ---- } /* ARGSUSED */ ! void backup_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; *************** *** 72,78 **** } /* ARGSUSED */ ! XtCallbackProc expand_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; --- 72,78 ---- } /* ARGSUSED */ ! void expand_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; *************** *** 81,87 **** } /* ARGSUSED */ ! XtCallbackProc help_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; --- 81,87 ---- } /* ARGSUSED */ ! void help_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; *************** *** 93,99 **** } /* ARGSUSED */ ! XtCallbackProc change_help(w, call_data, client_data) Widget w; XtPointer call_data, client_data; --- 93,99 ---- } /* ARGSUSED */ ! void change_help(w, call_data, client_data) Widget w; XtPointer call_data, client_data; *************** *** 124,130 **** } /* ARGSUSED */ ! XtCallbackProc locate_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; --- 124,130 ---- } /* ARGSUSED */ ! void locate_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; *************** *** 144,150 **** } /* ARGSUSED */ ! XtCallbackProc file_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; --- 144,150 ---- } /* ARGSUSED */ ! void file_handler(w, call_data, client_data) Widget w; XtPointer call_data, client_data; *************** *** 185,191 **** /* event handlers */ /* ARGSUSED */ ! XtEventHandler xaw_redraw_table(w, data, xev, ctd) Widget w; XtPointer data; --- 185,191 ---- /* event handlers */ /* ARGSUSED */ ! void xaw_redraw_table(w, data, xev, ctd) Widget w; XtPointer data; *************** *** 199,205 **** } /* ARGSUSED */ ! XtEventHandler xaw_button_press(w, data, xev, ctd) Widget w; XtPointer data; --- 199,205 ---- } /* ARGSUSED */ ! void xaw_button_press(w, data, xev, ctd) Widget w; XtPointer data; *************** *** 213,219 **** } /* ARGSUSED */ ! XtEventHandler xaw_button_release(w, data, xev, ctd) Widget w; XtPointer data; --- 213,219 ---- } /* ARGSUSED */ ! void xaw_button_release(w, data, xev, ctd) Widget w; XtPointer data; *************** *** 227,233 **** } /* ARGSUSED */ ! XtEventHandler xaw_resize(w, data, xev, ctd) Widget w; XtPointer data; --- 227,233 ---- } /* ARGSUSED */ ! void xaw_resize(w, data, xev, ctd) Widget w; XtPointer data; *************** *** 251,257 **** } /* ARGSUSED */ ! XtEventHandler xaw_key_press(w, data, xev, ctd) Widget w; XtPointer data; --- 251,257 ---- } /* ARGSUSED */ ! void xaw_key_press(w, data, xev, ctd) Widget w; XtPointer data; *************** *** 293,299 **** return True; } ! XtCallbackProc confirm_callback(w, call_data, client_data) Widget w; XtPointer call_data, client_data; --- 293,300 ---- return True; } ! /* ARGSUSED */ ! void confirm_callback(w, call_data, client_data) Widget w; XtPointer call_data, client_data; *************** *** 356,359 **** --- 357,380 ---- return(do_confirmer("Really discard current game?")); else return True; + } + + char * + get_name_field() + { + Arg args[1]; + char *fname; + + XtSetArg(args[0], XtNstring, &fname); + XtGetValues(file, args, ONE); + + /* nothing in the field doesn't return a NIL pointer */ + if (strlen(fname)) { + /* remove the leading whitespace */ + fname = remove_newlines(fname); + locate(fname); + return fname; + } else { + return (get_selection()); + } } *** /tmp/spider/./README Mon Apr 30 19:55:43 1990 --- ./README Mon Apr 30 20:04:34 1990 *************** *** 1,3 **** --- 1,9 ---- + Patch level 1: + fixed bug, some problems with Imakefile. + fixed bug, can no longer see turned-over cards with middle mouse. + fixed bug, "f" will use the text field then selection for information. + added, patch_level variable to version.c file. + Spider is a challenging double decked solitaire game. Unlike most soilitaire games, skill is just as important as luck. *** /tmp/spider/./xaw_ui.c Mon Apr 30 19:55:59 1990 --- ./xaw_ui.c Mon Apr 30 19:01:36 1990 *************** *** 6,12 **** * * See copyright.h for the terms of the copyright. * ! * @(#)xaw_ui.c 2.2 90/04/27 * */ --- 6,12 ---- * * See copyright.h for the terms of the copyright. * ! * @(#)xaw_ui.c 2.3 90/04/30 * */ *************** *** 40,46 **** extern int deltamod; extern char *helpDir; ! extern char helpfiles[5][256]; struct _resources { Bool confirm; --- 40,46 ---- extern int deltamod; extern char *helpDir; ! extern char helpfiles[6][256]; struct _resources { Bool confirm; *************** *** 142,148 **** int argc; char **argv; { - XWMHints xwmh; char *save_file = NULL; int i, nargs; --- 142,147 ---- *** /tmp/spider/./xv_ui.c Mon Apr 30 19:56:00 1990 --- ./xv_ui.c Mon Apr 30 19:33:40 1990 *************** *** 16,28 **** */ #include <stdio.h> - #include <sys/param.h> - #include <sys/types.h> #include <xview/xview.h> #include <xview/canvas.h> #include <xview/icon_load.h> #include <xview/panel.h> - #include <xview/scrollbar.h> #include <xview/svrimage.h> #include <xview/text.h> #include <xview/defaults.h> --- 16,25 ---- *** /tmp/spider/./xv_stubs.c Mon Apr 30 19:56:02 1990 --- ./xv_stubs.c Mon Apr 30 19:50:20 1990 *************** *** 10,18 **** * @(#)xv_stubs.c 2.2 90/04/27 */ #include <stdio.h> ! #include <sys/param.h> ! #include <sys/types.h> ! #include <sys/file.h> #include <xview/xview.h> #include <xview/panel.h> #include <xview/textsw.h> --- 10,16 ---- * @(#)xv_stubs.c 2.2 90/04/27 */ #include <stdio.h> ! #include <X11/Xlib.h> #include <xview/xview.h> #include <xview/panel.h> #include <xview/textsw.h> *************** *** 19,25 **** #include <xview/xv_xrect.h> #include <xview/seln.h> #include <xview/defaults.h> - #include <X11/Xlib.h> #include "xv_ui.h" static char helpfiles[HELP_MAX+1][32]; --- 17,22 ---- *************** *** 551,556 **** --- 548,565 ---- xv_set(ip->subwindow1->textsw1, TEXTSW_FILE, NULL, 0); + } + + char * + get_name_field() + { + char *val; + char *get_selection(); + + if ((val = (char *)xv_get(spider_window1->textfield1, PANEL_VALUE)) == NULL || strlen(val) == 0) { + val = get_selection(); + } + return (val); } char * *** /tmp/spider/./gfx.c Mon Apr 30 19:56:03 1990 --- ./gfx.c Mon Apr 30 19:00:48 1990 *************** *** 6,12 **** * * See copyright.h for the terms of the copyright. * ! * @(#)gfx.c 2.1 90/04/25 * */ --- 6,12 ---- * * See copyright.h for the terms of the copyright. * ! * @(#)gfx.c 2.2 90/04/30 * */ *************** *** 176,181 **** --- 176,185 ---- back_delta_x = (CARD_WIDTH - logo_width)/2; back_delta_y = (CARD_HEIGHT - logo_height)/2; + + /* XXX -- workaround for X11R4 bug */ + back_delta_x -= CARD_WIDTH; + back_delta_y -= CARD_HEIGHT; if (is_color) { cmap = DefaultColormap(dpy, screen); *** /tmp/spider/./spider.info Mon Apr 30 19:55:56 1990 --- ./spider.info Mon Apr 30 20:06:15 1990 *************** *** 35,42 **** The file also includes a human-readable text representation of the current tableau, similar to those that appear in the Help "Examples". - When using the accellerator "W" or "w", the filename is taken from the contents of the current primary selection instead of the Name textfield. - [File: Resume from File] reads a file created by the [File: Save in File] command. The name of the file is taken from the Name item. It can also read various partial files; in particular, if all but the first line of the file has been deleted, it will restore the most recent position and, if possible, the original deck (in case you want to Start Over), but it will not be able to Back Up over the moves. --- 35,40 ---- SHAR_EOF fi exit 0 # End of shell archive dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.